﻿#region copyright
//<copyright>
// Copyright(C) 2012 TrackerRealm Corporation
// This file is part of the open source project - Jazz. http://jazz.codeplex.com
// 
// Jazz is open software: you can redistribute it and/or modify it 
// under the terms of the GNU Affero General Public License (AGPL) as published by 
// the Free Software Foundation, version 3 of the License.
// 
// Jazz is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty 
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
//  See the GNU Affero General Public License (AGPL) for more details.
// 
// You should have received a copy of the GNU General Public 
// License along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
//
// REMOVAL OF THIS NOTICE IS VIOLATION OF THE COPYRIGHT. 
//</copyright>
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace TrackerRealm.Jazz.Client.Custom
{
    /// <summary>
    /// 
    /// </summary>
    public static class CustomExtensionMethods
    {
        #region GetMembers
        /// <summary>
        /// Convenience method that gets the public members of this '<see cref="jObject"/>'.
        /// </summary>
        /// <returns></returns>
        public static IEnumerable<MemberInfo> GetMembers(this jObject jazzObj)
        {
            return jazzObj.GetType().GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
        }
        #endregion
        #region GetWrappedMembers
        /// <summary>
        /// Convenience method that returns the wrapped member objects for this '<see cref="jObject"/>'.
        /// </summary>
        /// <returns></returns>
        public static IEnumerable<jMemberInfo> GetWrappedMembers(this jObject jazzObj)
        {
            return jazzObj.GetMembers().ToWrapper(jazzObj);
        }
        #endregion
    }
}
